<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
    <meta charset="utf-8">
    <title>添加问题</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" th:href="@{/js/layui/css/layui.css}" media="all"/>
    <link rel="stylesheet" th:href="@{/css/public.css}" media="all"/>
    <link rel="stylesheet" th:href="@{/js/page/index/jqueryui/jquery-ui.css}"/>
    <link rel="stylesheet" th:href="@{/css/knowledgeBase/addKnowledgeBase.css}"/>
    <link rel="stylesheet" th:href="@{/css/knowledgeBase/selectStyle.css}"/>
    <style>

        .layui-layer-page .layui-layer-content {
            overflow: visible;
        !important;
        }

        .layui-col-space10 {
            margin: 0px
        }

       /* .point {
            position: absolute;
            left: 50%;
            top: 50%;
        }

        .pop {
            width: 500px;
            height: 500px;
            position: absolute;
            left: -250px;
            top: -250px;
            border: 2px solid red;
        }*/

    </style>

</head>


<body class="childrenBody" style="-webkit-backface-visibility: hidden">
<div id="addDiv" >
    <div class="houselabel" >
        <form class="layui-form layui-row layui-col-space10" style="padding: 5px 5px;" id="addKnowledgeBaseForm" >
            <!--id隐藏-->
            <input type="hidden" name="id" id="knowledgeBaseId" th:value="${editKnowledgeBase.id}"/>
            <div class="layui-form-item" style="text-align: left;">
                <label class="layui-form-label">类型:</label>
                <div class="layui-input-block">
                    <input type="radio" name="knowledgeType" value="COMMON" title="一般问题 "
                           th:checked="${editKnowledgeBase.knowledgeType.value=='c'}?true:false"/>
                    <input type="radio" name="knowledgeType" value="BUSINESS" title="业务问题"
                           th:checked="${editKnowledgeBase.knowledgeType.value=='b'}?true:false"/>

                </div>
                <span id="describe">与业务场景无关的问题,如：您贵姓</span>
            </div>
            <!--所属话术包一-->
            <input id="packageId" type="hidden" name="packageId" th:value="${editKnowledgeBase.packageId}">
            <!--<div class="layui-form-item" id="packageDiv" >
                <label class="layui-form-label">所属话术包:</label>
                <div class="layui-input-block">
                    <input id="packageId" type="hidden" name="packageId" th:value="${editKnowledgeBase.packageId}">
                    <input id="packageText" type="text" class="layui-input "
                           placeholder="输入话术包关键字搜索并选择" th:value="${packageText}" lay-verify="packageIdNotNull">
                </div>
            </div>-->
            <!--所属的知识库类型-->
            <!--<th:block th:value="${editKnowledgeBase.affectType == 'COMMON'}">
                <div class="layui-form-item" id="belongKnowledgeTypeDiv" style="display: none">
                    <label class="layui-form-label">所属行业类型:</label>
                    <div class="layui-input-block">
                        <select name="belongIndustryTypeId" lay-filter="belongKnowledgeTypes" id="belongIndustryTypeId" lay-search="" lay-verify="belongIndustryTypeIdNotNull" >
                            <option value="">请选择所属知识库类型(可输关键词)</option>
                            <option th:each="it:${belongIndustryTypes}" th:value="${it.id}" th:text="${it.name}" th:selected="${it.id == editKnowledgeBase.packageId}"></option>
                        </select>
                    </div>
                </div>
            </th:block>-->
            <div class="layui-form-item" id="titleDiv">
                <label class="layui-form-label">标题:</label>
                <div class="layui-input-block">
                    <input id="title" type="text" name="title" class="layui-input newsName" lay-verify="required|title|alreadyExisted"
                           th:value="${editKnowledgeBase.title}" placeholder="请概括问题场景，如：客户询问利息" th:disabled="${(refPackageId !=null && refPackageId!='' && refPackageId!='null')?true:false}">
                    <input id="originalTitle" th:value="${editKnowledgeBase.title}" type="hidden"/>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">问法:</label>
                <div class="layui-input-block">
                    <textarea id="questions" required lay-verify="required|textarea" placeholder="请输入问题多种问法，并回车分割"
                              class="layui-textarea" name="howAskQuestions"></textarea>
                    <input id="howAskQuestions" type="hidden" th:value="${questionsString}"/>
                    <div>
                        <input type="button" class="layui-btn layui-btn-xs layui-bg-gray" value="自动分词"
                               id="autoAnalysis"/>
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">关键词:</label>
                <div class="layui-input-block" id="keywordBox">
                    <input type="text" class="layui-input newsName" lay-verify="newsName" placeholder="请输入关键词,按回车结束"
                           id="addKeyword">
                    <input id="needKeywords" name="keyworlds" type="hidden" th:value="${keyworldString}"/>
                    <div id="keywordDiv"><span id="keywordColor">匹配到该分支的关键词</span></div>
                </div>

            </div>

            <div class="layui-form-item" style="text-align: left;margin-bottom: 0px;" id="answerBox">
                <label class="layui-form-label">回答方式:</label>
                <div class="layui-input-block">
                    <input id="oneToOne" type="radio" name="answerType" lay-filter="radioAnswerType" value="ONE_TO_ONE"
                           checked title="单句问答"
                           th:checked="${editKnowledgeBase.answerType.value == 'o'}">
                    <input id="mutiSession" type="radio" name="answerType" lay-filter="radioAnswerType"
                           value="MUTI_SESSION" title="进入多轮会话"
                           th:checked="${editKnowledgeBase.answerType.value == 'm'}"
                    >
                    <div id="oneToOneanswerDiv"><a href="javascript:void(0)" id="oneToOneanswer" onclick="addAnswer()"><span id="oneToOneanswerSpan">+&nbsp;标准答案</span></a></div>
                </div>

            </div>

            <div class="layui-form-item " id="answerAfter" style="display: none">
                <label class="layui-form-label">答后操作:</label>
                <div class="layui-input-block">
                    <select name="afterAnswerOptionalType" lay-verify="" lay-filter="answerOperation"
                            id="answerOperation">
                        <option value="STOP"  selected
                                th:selected="${editKnowledgeBase.afterAnswerOptionalType == null ? false: editKnowledgeBase.afterAnswerOptionalType.value =='e' }"
                        >挂机
                        </option>
                        <!--<option value="WAIT_CUSTOMER_ANSWER" selected
                                th:selected="${editKnowledgeBase.afterAnswerOptionalType == null ? false: editKnowledgeBase.afterAnswerOptionalType.value =='o' }"
                        >等待客户回答
                        </option>-->
                        <option value="ORIGIN_FLOW"
                                th:selected="${editKnowledgeBase.afterAnswerOptionalType == null ? false: editKnowledgeBase.afterAnswerOptionalType.value =='n'}"
                        >跳转到原主动流程
                        </option>
                        <option value="ASSIGN"
                                th:selected="${editKnowledgeBase.afterAnswerOptionalType == null ? false: editKnowledgeBase.afterAnswerOptionalType.value =='a'}"
                        >跳转到指定主动流程
                        </option>
                    </select>
                </div>
            </div>
            <!--储存标准答案-->
            <input id="ontoOneText" name="oneToOneResult" type="hidden" lay-verify="mustNoNull"
                   th:value="${oneToOneResult}">
            <!--单句问答历程一对一-->
            <div class="layui-form-item" id="selectAnswerType" style="display: none">
                <label class="layui-form-label">选择流程:</label>
                <div class="layui-input-block">
                    <input id="skipFlowId" type="hidden" name="skipFlowId" th:value="${editKnowledgeBase.skipFlowId}">
                    <input id="skipFlowText" type="text" class="layui-input "
                           placeholder="输入流程关键字搜索并选择" th:value="${SkipFlowText}">
                </div>
            </div>


            <!--<div class="layui-form-item" id="multiSelectAnswerType" style="display: none">
                <label class="layui-form-label">选择流程</label>
                <div class="layui-input-block ">
                    <select name="mutiSessionFlowId" lay-verify="" lay-search id="mutiSessionFlowId">
                        <option value="">可以输入内容进行筛选</option>
                    </select>
                </div>
            </div>-->
            <!--多轮会话问答历程一-->
            <div class="layui-form-item" id="multiSelectAnswerType" style="display: none">
                <label class="layui-form-label">选择流程:</label>
                <div class="layui-input-block">
                    <input id="mutiSessionFlowId" type="hidden" name="mutiSessionFlowId"
                           th:value="${editKnowledgeBase.mutiSessionFlowId}">
                    <input id="mutiSessionText" type="text" class="layui-input " th:value="${MutiSessionFlowText}"
                           placeholder="输入流程关键字搜索并选择">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">是否可打断:</label>
                <div class="layui-input-block" >
                    <input type="checkbox" name="actionCodeBreak" title="打断话术" th:checked="${editKnowledgeBase?.actionCodeBreak==true?'checked':'false'}">
                </div>
            </div>


            <div class="layui-form-item">
                <label class="layui-form-label">用途:</label>
                <div class="layui-input-block" >
                    <th:block th:if="${knowledgeUsageTypes}">
                        <input type="checkbox" th:each="it:${knowledgeUsageTypes}" name="usageType" th:title="${it.desc}" th:value="${it.value}"
                               lay-skin="primary" th:checked="${selUsageTypes !=null?#lists.contains(selUsageTypes,#strings.toString(it.value)):'false'}" >
                    </th:block>
                </div>
            </div>
            <input id="affectType" type="text" name="affectType" style="display: none;" th:value="${affectType}" />
            <!--<div  id="selectAnswerType" th:if="${editKnowledgeBase.answerType.value eq 'm'}?class='layui-form-item':class='layui-form-item displaynoneClass'" >-->

            <!--<div class="layui-form-item">
                <label class="layui-form-label">其他设置:</label>
                <div class="layui-input-block">
                    <input type="text" class="layui-input newsName" lay-verify="newsName" placeholder="请输入话术名称">
                </div>
            </div>-->
            <div style="display: none"
                 id="myButton">
                <!--                <button type="button" class="layui-btn layui-btn-primary"
                                        style="width: 100px;margin-left: 47%;margin-top: 7px;background-color: #b2b2b2;"
                                        id="closeUpdateWindow">
                                    取消
                                </button>-->
                <button type="button" class="layui-btn" lay-submit lay-filter="addKnowledgeBase"
                        style="width: 100px;margin-left: 35px;margin-top: 7px;">
                    保存
                </button>
            </div>
        </form>

        <!--右击链接-->
        <div class="todoMenu keyWordMenu" style="display: none">
            <div class="findSameMean" >选择近义词</div>
        </div>

    </div>
</div>
<!--自动分词-->
<div id="selectKeyword" style="display: none">

    <select multiple="multiple"  id="autoKeywords">

    </select>


    <div  class="btn-bar" style="display: inline-block; position: absolute">
        <p><span><input type="button" value=">" class="btn" id="moveToRight" ></span></p>
        <p><span><input type="button" value="<" class="btn" id="moveToLeft" ></span></p>
        <p><span><input type="button" value=">>" class="btn" id="moveAllToRight" ></span></p>
        <p><span><input type="button" value="<<" class="btn" id="moveAllToLeft" ></span></p>
    </div>

    <select multiple="multiple"  id="addKeywords">

    </select>

</div>

<script th:inline="javascript">
    var oldKeyworldString = [[${keyworldString}]];
    if(oldKeyworldString ==null || oldKeyworldString ==undefined){
        oldKeyworldString  = "";
    }
    const refPackageId = [[${refPackageId}]];
    const brotherWinName = [[${brotherWinName}]];
    const packageId = [[${packageId}]];
    const affectType = [[${affectType}]];
    const baseUrl = [[${#servletContext.contextPath}]];
    const existKnowledgeBaseResultVos  = [[${knowledgeBaseResultVos}]];

</script>
<script type="text/javascript" th:src="@{/js/layui/layui.js}"></script>
<script type="text/javascript" th:src="@{/js/jquery-1.7.2.min.js}"></script>
<script type="text/javascript" th:src="@{/js/page/index/jqueryui/jquery-ui.js}"></script>
<script type="text/javascript" th:src="@{/js/page/knowledgeBase/editKnowledgeBase.js(v=${new java.util.Date().getTime()})}"></script>
<script type="text/javascript"   th:src="@{/js/page/utils.js}"></script>

</body>


</html>










